<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.model.*,java.util.*"%>
<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager" %>
<%@ include file="/header.jsp" %>


<p align="right">
	<c:if test="${!empty loginUser}">
	    登录名：${loginUser.username}&nbsp;&nbsp;&nbsp;&nbsp;
	<p align="right">
	  <a href="${ctx}/user/editUserPassword.jsp">修改密码</a>
	 </p>
	 <p align="right">
	  <a href="${ctx}/user/addUser.jsp">用户注册</a>
	 </p>
	 <p align="right">
	  <a href="${ctx}/user/manager?func=logout">退出</a>
	  </p>
	<center>
	  <a href="${ctx}/message/addMessage.jsp">添加留言</a>&nbsp;&nbsp;&nbsp;&nbsp;
	<c:if test="${msg=='all'}">
	  <a href="${ctx}/message/manager?msg=my">我的留言</a>&nbsp;&nbsp;&nbsp;&nbsp;
	</c:if>
	<c:if test="${msg!='all'}">
	  <a href="${ctx}/message/manager?msg=all">所有留言</a>&nbsp;&nbsp;&nbsp;&nbsp;
	</c:if>
	
	<c:if test="${loginUser.roleId==1}">
	  <a href="${ctx}/user/manager">用户管理</a>
	</c:if>
	</center>
   </c:if>
   <c:if test="${empty loginUser }">
   		<a href="${ctx}/user/login.jsp">登录</a>
   		<a href="${ctx}/user/addUser.jsp">注册</a>
   </c:if>
<center>
	<h1>留言内容</h1>
	<br>
    <c:forEach items="${page.data}" var="obj">
	<table width="600" border="1" bordercolor="000000"
		style="table-layout: fixed; word-break: break-all">
		<tr>
			<td width="100" bordercolor="ffffff">编号:</td>
			<td width="500" bordercolor="ffffff">${obj.id}</td>
		</tr>
		<tr>
			<td bordercolor="ffffff">姓名:</td>
			<td bordercolor="ffffff">${obj.name}</td>
		</tr>
		<tr>
			<td bordercolor="ffffff">主题:</td>
			<td bordercolor="ffffff">${obj.title}</td>
		</tr>
		<tr>
			<td valign="top" bordercolor="ffffff">内容:</td>
			<td valign="top" bordercolor="ffffff">${obj.content}</td>
		</tr>
		<tr>
			<td bordercolor="ffffff">时间:</td>
			<td bordercolor="ffffff">${obj.time}</td>
		</tr>
		<c:if test="${loginUser.username==obj.name}">
		<tr>
			<td bordercolor="ffffff">操作:</td>
			<td>
			<a href="${ctx}/message/manager?func=delete&id=${obj.id}">删除</a>
			<a href="${ctx}/message/manager?func=edit&id=${obj.id}">修改</a>
	        </td>	
		</tr>
		</c:if>
	</table>
	<br>
	</c:forEach>
	    <pg:pager url="${ctx}/message/manager" items="${page.maxRows}" maxPageItems="${page.pageSize}"  maxIndexPages="5">
	   <pg:index>
	   		<pg:first unless="current">
				<a href="${pageUrl}&pageNumber=${pageNumber}">首页</a>
			</pg:first>
			<pg:prev>
				<a href="${pageUrl}&pageNumber=${pageNumber}">上一页(${pageNumber})</a>
			</pg:prev>
			<pg:pages>
				<a href="${pageUrl}&pageNumber=${pageNumber}">${pageNumber}</a>				
			</pg:pages>
			<pg:next>
				<a href="${pageUrl}&pageNumber=${pageNumber}">下一页(${pageNumber})</a>
			</pg:next>
			<pg:last unless="current">
				<a href="${pageUrl}&pageNumber=${pageNumber}">尾页</a>
			</pg:last>

       </pg:index>
    </pg:pager>
</center>
